<?php

defined('__MAPEXEC__') or die('No direct access allowed');

/**
 * A two dimensional shape based on geographic coordinates.
 */
class Maps_Map_Polygon extends Maps_Map_PolyLine {
  
  private $fillColor = '#0000FF';
  private $fillOpacity = 1.0;
  
  /**
   * Gets the fill color for this polygon.
   * @param   void
   * @return  string  Fill color
   */
  public function getFillColor() {
    return $this->fillColor;
  }
  
  /**
   * Gets the fill opacity for this polygon. Export objects that
   * do not implement polygon opacity will make any non zero
   * opacity fully opaque.
   * @param   void
   * @return  float   Polygon fill opacity.
   */
  public function getFillOpacity() {
    return $this->fillOpacity;
  }
  
  /**
   * Checks to see if this polygon is closed, i.e. it has at
   * least 3 points to create a 2D shape.
   * @param   void
   * @return  bool  True if closed, false otherwise
   */
  public function isClosed() {
    return $this->getCount() > 2 ? true : false;
  }
  
  /**
   * Sets the polygon fill color.
   * @param   string  RGB hex color: #RRGGBB
   * @return  void
   */
  public function setFillColor($color='#0000FF') {
    $this->fillColor = $color;
  }
  
  /**
   * Sets the stroke opacity of this polygon.
   * @param   float   Opacity value: 0.0 (transparent) to 1.0 (opaque)
   * @return  void
   */
  public function setFillOpacity($opacity=1.0) {
    $this->fillOpacity = $opacity;
  }
  
}

?>